clean up use of _WIN32 Replace the use of _WIN32 in libc++. Replace most use with a C runtime check _LIBCPP_MSVCRT or the new _LIBCPP_WIN32 to indicate that we are using the Win32 API. Use a new _LIBCPP_WCHAR_IS_UCS2 to indicate that we are on an environment that has a short wchar_t. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290910 91177308-0d34-0410-b5e6-96231b3b80d8 
diff --git a/include/__config b/include/__config index 7b175a1..4f0fe1d 100644 --- a/include/__config +++ b/include/__config 
@@ -154,11 +154,13 @@  # define _LIBCPP_HAS_QUICK_EXIT  #endif // __NetBSD__   -#ifdef _WIN32 +#if defined(_WIN32) +# define _LIBCPP_WIN32API 1  # define _LIBCPP_LITTLE_ENDIAN 1  # define _LIBCPP_BIG_ENDIAN 0 +# define _LIBCPP_SHORT_WCHAR 1  // Compiler intrinsics (MSVC) -#if defined(_MSC_VER) && _MSC_VER >= 1400 +# if defined(_MSC_VER) && _MSC_VER >= 1400  # define _LIBCPP_HAS_IS_BASE_OF  # endif  # if defined(_MSC_VER) && !defined(__clang__) @@ -167,11 +169,11 @@  # define _LIBCPP_TOSTRING(x) _LIBCPP_TOSTRING2(x)  # define _LIBCPP_WARNING(x) __pragma(message(__FILE__ "(" _LIBCPP_TOSTRING(__LINE__) ") : warning note: " x))  # endif -# // If mingw not explicitly detected, assume using MS C runtime only. +// If mingw not explicitly detected, assume using MS C runtime only.  # ifndef __MINGW32__  # define _LIBCPP_MSVCRT // Using Microsoft's C Runtime library  # endif -#endif // _WIN32 +#endif // defined(_WIN32)    #ifdef __sun__  # include <sys/isa_defs.h> @@ -195,7 +197,7 @@  // including accesses to the special files under /dev. C++11's  // std::random_device is instead exposed through a NaCl syscall.  # define _LIBCPP_USING_NACL_RANDOM -#elif defined(_WIN32) +#elif defined(_LIBCPP_WIN32API)  # define _LIBCPP_USING_WIN32_RANDOM  #else  # define _LIBCPP_USING_DEV_RANDOM @@ -520,8 +522,15 @@    #endif // __clang__ || __GNUC__ || _MSC_VER || __IBMCPP__   +#if defined(__ELF__) +#define _LIBCPP_OBJECT_FORMAT_ELF 1 +#elif defined(__MACH__) +#define _LIBCPP_OBJECT_FORMAT_MACHO 1 +#else +#define _LIBCPP_OBJECT_FORMAT_COFF 1 +#endif   -#ifdef _WIN32 +#if defined(_LIBCPP_OBJECT_FORMAT_COFF)  #if defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)  # define _LIBCPP_DLL_VIS  # define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS @@ -546,6 +555,7 @@  #define _LIBCPP_TYPE_VIS_ONLY  #define _LIBCPP_FUNC_VIS_ONLY  #define _LIBCPP_ENUM_VIS +  #if defined(_LIBCPP_MSVC)  # define _LIBCPP_INLINE_VISIBILITY __forceinline  # define _LIBCPP_ALWAYS_INLINE __forceinline @@ -555,7 +565,7 @@  # define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__))  # define _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY __attribute__ ((__always_inline__))  #endif -#endif // _WIN32 +#endif // defined(_LIBCPP_OBJECT_FORMAT_COFF)    #ifndef _LIBCPP_HIDDEN  #if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) @@ -778,14 +788,14 @@  #define _LIBCPP_NONUNIQUE_RTTI_BIT (1ULL << 63)  #endif   -#if defined(__APPLE__) || defined(__FreeBSD__) || defined(_WIN32) || \ +#if defined(__APPLE__) || defined(__FreeBSD__) || defined(_LIBCPP_MSVCRT) || \  defined(__sun__) || defined(__NetBSD__) || defined(__CloudABI__)  #define _LIBCPP_LOCALE__L_EXTENSIONS 1  #endif    #if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))  // Most unix variants have catopen. These are the specific ones that don't. -#if !defined(_WIN32) && !defined(__BIONIC__) && !defined(_NEWLIB_VERSION) +#if !defined(__BIONIC__) && !defined(_NEWLIB_VERSION)  #define _LIBCPP_HAS_CATOPEN 1  #endif  #endif @@ -959,7 +969,7 @@  #endif    #if !defined(_LIBCPP_HAS_NO_OFF_T_FUNCTIONS) -#if defined(_WIN32) || defined(_NEWLIB_VERSION) +#if defined(_LIBCPP_MSVCRT) || defined(_NEWLIB_VERSION)  #define _LIBCPP_HAS_NO_OFF_T_FUNCTIONS  #endif  #endif